<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no"/>
    <title>vue</title>
    <style>
        [v-cloak]{
            display:none;
        }
    </style>
</head>
<body>
<div id="app" v-cloak>
    商品：苹果电脑<br/>
    价格：{{price}}<br/>
    数量：<button type="button" @click="--amount">-</button> <input style="width:50px" type="text" v-model="amount" /> <button type="button" @click="++amount">+</button><br/>
    金额：{{total}}
</div>
<script src="js/vue.js"></script>
<script>
    new Vue({
        el:"#app",
        data(){
            return {
                price:17000,
                amount:1
            }
        },
        computed:{
            total(){
                var total=this.amount*this.price;
                return total
            }
        }
    })
</script>
</body>
</html>
